package com.fanco.learn_datastruct_leetcode.juc;/**
 * @author qiaowang 2021/8/11
 */

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author fanco
 * @Desc CAS使用Demo
 */
public class CasDemo {
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(10);
        System.out.println(atomicInteger.compareAndSet(10, 200) + "\t 当前值为" + atomicInteger.get());
        System.out.println(atomicInteger.compareAndSet(10, 200) + "\t 当前值为" + atomicInteger.get());
    }
}
